<!DOCTYPE html>
<html>
<head>
    <title>文章信息表</title>
    <#include "/header.html">

    <style>
        *{font-size:12px}
        .out1,in1{border:1px inset #ccc;height:20px;overflow-y:hidden;line-height:20px;width:240px}
        #input1{border:0px;clear:none}
        img {border-width: 0px 0px 0px 0px} <!--就是这行 代码起作用-->

    </style>
    <script language="javascript" defer>
        $(document).ready(function() {
            $("#code").val('');
        });
        function selected(name,code) {
            var ids = $("#code").val();
            if(ids.indexOf(code) == -1){  //没有找到匹配的id
                $("#in1").append("<a href=# onclick=javascript:deleteCode("+code+");><div style='width:auto;float:left;' id="+code+">"+name+';'+" </div></a>");
                $("#"+code).hover(function(){
                    $(this).css("background","yellow");},function(){
                    $(this).css("background","white");
                });
                //添加隐藏域的值
                ids += code + ",";
                $("#code").val(ids);
            }
            console.log($("#code").val());
        }
        function deleteCode(code){
            var ids = $("#code").val();
            $("#code").val(ids.replace(code+",",""));
            $("#"+code).remove();
        }
        function xxx() {
            console.log(111)
            var a=$(".browsers").val();
            var b=$(".browsers").val();
            console.log(">>>"+a+">>"+b)
            selected(a,b);

        }
    </script>

</head>
<body>
            <div class="out1" id="out1" exp="">
                <div class="in1" id="in1" exp="" onmousemove="">
                </div>
            </div>
            <input style="display: none" type="text" id="code" name="code"/>
            <div class="list" exp="">
                <input class="browsers" list="type" onchange="xxx()">
                <datalist id="type">
                    <option value="123">xxx</option>
                    <option value="222">www</option>
                    <option value="333">qqq</option>
                </datalist>
            </div>
</body>
</html>